package cn.hdmis.security.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;

import cn.hdmis.dao.impl.BaseDaoImp;
import cn.hdmis.security.dao.ResourcesDao;
import cn.hdmis.security.entity.Resources;

public class ResourcesDaoImpl extends BaseDaoImp<Resources> implements ResourcesDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<Resources> getRootList() {
		return this.getHibernateTemplate().executeFind(new HibernateCallback<List<Resources>>() {
			@Override
			public List<Resources> doInHibernate(Session session) throws HibernateException,
					SQLException {
				// TODO Auto-generated method stub
				return session.createQuery("from Resources where parent is null").list();
			}
		});
	}

	
}
